<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="reportTitle" value="SPC PPK分析报表" />

<%@ include file="/common/report_head.jsp" %>
<%@ include file="/condition/sartTime_YMD_input.html"%>
<%@ include file="/condition/endTime_YMD_input.html"%>
<%@ include file="/condition/fab_sumo_must.html"%>
<%@ include file="/condition/toolg_sumo.html"%>
<%@ include file="/condition/toolType_radio.html"%>
<%@ include file="/condition/tool_sumo.html"%>
<%@ include file="/condition/collectType_sumo.html"%>
<%@ include file="/condition/reportType_radio.html"%>
<%@ include file="/condition/controlChartGrp_sumo.html"%>
<%@ include file="/condition/controlChart_sumo.html"%>

<%@ include file="/common/report_middle.jsp" %>
<%@ include file="/charts-grid/echarts2.html"%>
<div class="col-md-12" style="height: 420px;">
    <div id="pqGrid"></div>
</div>
<%@include file="/common/report_end.jsp" %>


<script>
    $(document).ready(function () {
        $("title").text("SPC PPK分析报表");
        $("label:contains('管制图组:')").addClass("keyCss");
        $("label:contains('管制图:')").addClass("keyCss");

        $('#query_btn').click(function (){
            if($("#controlChartGrpSumo").val() === null || $("#controlChartGrpSumo").val() === '' || $("#controlChartSumo").val() === null || $("#controlChartSumo").val() === ''){
                showErrorDialog("0000002", "管制图组和管制图为必选项"); return false;
            }
            initGridAndChart();
            ajax('/jn-report/report/spc_ppk_report.do' ,loadConditionMapData(), true, ajax_successful);

            function ajax_successful(outTrxObj) {
                if(outTrxObj.gridData.length < 1) { showMessengerDialog("数据查询为空"); return false; }

                //Chart图数据赋值
                loadEchartsData(myChart, $("#charts"), outTrxObj.chartsData);

                // Grid表格动态列
                var colM = [{halign:'center', align:'center', dataIndx: 'chart_name', title: '管制图名称', width: 260, editable: false, sortable: true},
                    {halign:'center', align:'center', dataIndx: 'tool_desc',  title: '设备名称', width: 220, editable: false, sortable: true}];
                for (var i=0; i<outTrxObj.dynamicColumn.length; i++){
                    var time_range = outTrxObj.dynamicColumn[i];
                    colM.push({halign:'center', align:'center', dataType: 'float', dataIndx: time_range, title: time_range, width: 220, editable: false, sortable: true});
                }
                _pqUtil.f.setColModel($("#pqGrid"), colM);
                _pqUtil.f.seTitle($("#pqGrid"), outTrxObj.gridTitle);
                _pqUtil.f.loadPqGridData($("#pqGrid"), outTrxObj.dynamicColumnJsonGridData);
            };
        });
    });
</script>
